package li.controller;

import li.dto.Porder;
import li.dto.TbUser;
import li.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/order")
public class OrderCtrl {
    @Autowired
    OrderService os;

    @RequestMapping("/insertOrder")
    public String addOrder(HttpSession session, Porder order){
        TbUser user = (TbUser) session.getAttribute("user");
        return os.createOrder(order,user);
//        try{
//
//        }catch (Exception e){
//            return e.getMessage();
//        }
    }
}
